﻿function ClientAddPriority() {
    Url = Portal.OfficeMan.Priority.GetAddUrl().value;
    window.open(Url, '_self');
    //ClientReading();
}

function ClientSaveAddPriority() {
    PriorityCode = document.getElementById("txtPriorityCode").value;
    PriorityName = document.getElementById("txtPriorityName").value;

    RetValue = Portal.OfficeMan.AddPriority.ServerSideAddPriority(PriorityCode, PriorityName).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    document.getElementById("txtPriorityCode").value = "";
    document.getElementById("txtPriorityName").value = "";
    document.getElementById("txtPriorityName").focus();
    //window.close();
}

function ClientUpdatePriority(PriorityId) {
    Url = Portal.OfficeMan.Priority.GetUpdateUrl(PriorityId).value;
    window.open(Url, '_self');
    //window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 800px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;');
    //ClientReading();
}

function ClientDeletePriority(PriorityId)
{
    Msg=Portal.OfficeMan.Priority.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = Portal.OfficeMan.Priority.ServerSideDeletePriority(PriorityId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    ClientReading();
}



function ShowClientUpdateUrlForm(PriorityId)
{
    Url = Portal.OfficeMan.Priority.GetUpdateUrl(PriorityId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    //window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 800px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    window.open(Url, '_self');
}


function ClientSaveUpdatePriority(PriorityId)
{
    PriorityName = document.getElementById("txtPriorityName").value;
    PriorityCode = document.getElementById("txtPriorityCode").value;

    RetValue = Portal.OfficeMan.UpdatePriority.ServerSideUpdatePriority(PriorityId, PriorityCode, PriorityName).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    window.open('default.aspx?WebPartId=Priority','_self');
}

function ClientReading() {
   document.getElementById("divProcessing").innerHTML = Portal.OfficeMan.Priority.GetProcessingText().value;
   setTimeout("RealClientReading()",10);
}

function RealClientReading() {
    rValue = Portal.OfficeMan.Priority.GetPriority().value;
    document.getElementById("divPriorityContent").innerHTML = rValue;
    document.getElementById("divProcessing").innerHTML = "";
}

